<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    //    var obj = {
    //     name:"zhangsan",
    //     age:124,
    //     sex:"男",
    //     id:1
    //    }
    //    for (const iterator of obj) {
    //        console.log(iterator);//obj is not iterable
    //    }
    var arr = ["nick","shanzan","sala","solo"];
    arr.name="数组";//在数组中添加一个自定义属性
    for (const key in arr) {
       console.log(key,arr[key]);//这个key是索引
    }
    console.log("-----------------------");
    for (const iterator of arr) {
        console.log(iterator);//iterator 这个就直接是对象了
    }
    </script>
</body>
</html>